This section describes the sprite media handler functions available to your application.
The SpriteMediaSetSpriteProperty function sets the specified property of a sprite.
pascal ComponentResult SpriteMediaSetSpriteProperty (
MediaHandler mh,
QTAtomID spriteID,
long propertyType,
void* propertyValue);
You call this function to modify a property of a sprite. You set the propertyType parameter to the property you want to modify. You set the spriteID parameter to the ID of the sprite whose property you want to set.
The type of data you pass for the propertyValue parameter depends on the property type. The following table lists the sprite properties and the data types of the corresponding property values.
kSpritePropertyMatrix |
MatrixRecord * |
kSpritePropertyVisible |
short |
kSpritePropertyLayer |
short |
kSpritePropertyGraphicsMode |
ModifierTrackGraphicsModeRecord * |
kSpritePropertyImageIndex |
short |
The SpriteMediaGetSpriteProperty function retrieves the value of the specified sprite property.
pascal ComponentResult SpriteMediaGetSpriteProperty (
MediaHandler mh,
QTAtomID spriteID,
long propertyType,
void* propertyValue);
You call this function to retrieve a value of a sprite property. You set the propertyType parameter to the property you want to retrieve. You set the spriteID parameter to the ID of the sprite whose property you want to retrieve.
On return, the propertyValue parameter contains a pointer to the specified property's value; the data type of that value depends on the property. The following table lists the sprite properties and the data types of the corresponding property values.
kSpritePropertyMatrix |
MatrixRecord * |
kSpritePropertyVisible |
short * |
kSpritePropertyLayer |
short * |
kSpritePropertyGraphicsMode |
ModifierTrackGraphicsModeRecord * |
kSpritePropertyImageIndex |
short * |
The SpriteMediaHitTestAllSprites function determines whether any sprites are at a specified location.
pascal ComponentResult SpriteMediaHitTestAllSprites (
MediaHandler mh,
long flags,
Point loc,
QTAtomID *spriteHitID);
You call this function to determine whether any sprites exist at a specified location in the coordinate system of a sprite track's movie. You can pass flags to this function to control the hit testing operation more precisely. For example, you may want the hit test operation to detect a sprite whose bounding box contains the specified location.
The SpriteMediaCountSprites function retrieves the number of sprites that currently exist in a sprite track.
pascal ComponentResult SpriteMediaCountSprites (
MediaHandler mh,
short* numSprites);
The SpriteMediaCountImages function retrieves the number of images that currently exist in a sprite track.
pascal ComponentResult SpriteMediaCountImages (
MediaHandler mh,
short* numImages);
The SpriteMediaGetIndImageDescription function retrieves an image description for the specified image in a sprite track.
pascal ComponentResult SpriteMediaGetIndImageDescription (
MediaHandler mh,
short imageIndex,
ImageDescriptionHandle imageDescription);
You set the imageIndex parameter to the index of the image whose image description you want to retrieve. The index must be between one and the number of available images. You can determine how many images are available by calling SpriteMediaCountImages .
The handle specified by the imageDescription parameter must be unlocked; this function resizes the handle if necessary.
The SpriteMediaGetDisplayedSampleNumber function retrieves the number of the sample that is currently being displayed.
pascal ComponentResult SpriteMediaGetDisplayedSampleNumber (
MediaHandler mh,
long* sampleNum);
The SpriteMediaGetSpriteName function returns the name of the sprite with the specified ID from the currently displayed sample.
pascal ComponentResult SpriteMediaGetSpriteName(
MediaHandler mh,
QTAtomID spriteID,
Str255 spriteName);
The SpriteMediaGetImageName function returns the name of the image with the specified index from the current key frame sample.
pascal ComponentResult SpriteMediaGetImageName(
MediaHandler mh,
short imageIndex,
Str255 imageName);
The SpriteMediaHitTestOneSprite function performs a hit testing operation on the sprite specified by the spriteID.
pascal ComponentResult SpriteMediaHitTestOneSprite(
MediaHandler mh,
QTAtomID spriteID,
long flags,
Point loc,
Boolean *wasHit);
Sprite indexes range from 1 to the number of sprites in the key sample.
The SpriteMediaSpriteIndexToID function returns the ID of the sprite specified by spriteIndex in spriteID.
pascal ComponentResult SpriteMediaSpriteIndexToID(
MediaHandler mh,
short spriteIndex,
QTAtomID *spriteID);
The SpriteMediaSpriteIDToIndex function returns the sprite index of the sprite specified by the spriteID.
pascal ComponentResult SpriteMediaSpriteIDToIndex(
MediaHandler mh,
QTAtomID spriteID,
short *spriteIndex);
The SpriteMediaGetIndImageProperty function returns a property value for the image specified by imageIndex .
pascal ComponentResult SpriteMediaGetIndImageProperty(
MediaHandler mh,
short imageIndex,
long imagePropertyType,
void *imagePropertyValue);
| Previous | Chapter Contents | Chapter Top | Next |